// 销售请求封装
import instance from '@/utils/request'

// 获取商品和对应的库存信息
const getGoodsAndStock = () => {
  return instance.get('/sale/getGoods')
}

// 销售商品
const saleGoods = (sale) => {
  return instance.post('/sale', sale)
}

// 修改销售订单
const updateSaleInfo = (sale) => {
  return instance.put('/sale/update_sale_info', sale)
}

// 删除销售订单
const deleteSaleInfo = (id) => {
  return instance.delete(`/sale/${id}`)
}
export const deleteSaleById = (id) => instance.delete(`/sale/delete/${id}`)

export { getGoodsAndStock, saleGoods, updateSaleInfo, deleteSaleInfo }

export const passSaleApi = (id) => instance.get(`/sale/pass/${id}`)
